import http from '@/utils/http'

// 单文件上传
export async function apiSingleFileUpload(fileObj = null) {
  const url = '/files/upload'
  const form = new FormData()
  form.append('file', fileObj)
  const { data = '' } = await http.post(url, form)
  return data
}

// 获取性别选项
export async function apiGetGenders() {
  return [
    { value: 'unknow', label: 'secret' },
    { value: 'male', label: 'male' },
    { value: 'female', label: 'female' },
  ]
}

// 代理获取bing每日壁纸
export async function apiGetBingWallpaper(args = {}) {
  const url = '/bing'
  const params = {
    idx: null, // {number}如果传, 指定为几天前的壁纸
    rand: null, // 如果传'1', 随机获取
    ...args,
  }
  const { data } = await http.get(url, params, { useLoading: false, useError: false })
  return data
}
